<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix = "c" uri="http://java.sun.com/jsp/jstl/core" %>

<jsp:useBean id="manager" class="beans.EditBean" scope="request" >
	<c:set target="${manager}" property="request" value="${pageContext.request}"></c:set>
	<c:set target="${manager}" property="response" value="${pageContext.response}"></c:set>
</jsp:useBean>
<c:set var="person"  value="${manager.person}" ></c:set>
<jsp:include page="header.jsp" />
<c:if test="${param.action == 'cancel'}">
	<c:redirect url="index.jsp"/>
</c:if>
<c:if test="${param.action == 'edit'}">
	<c:choose>
	      <c:when test="${manager.editUser}">
	      	<c:redirect url="index.jsp"/>
	      </c:when>
	      <c:otherwise>
			${manager.exception.exceptionCode.value}
	      </c:otherwise>
	</c:choose>
</c:if>
<div class="div_center">
	 <form id="editForm" method="post" onsubmit="return formIsValid()" action="">
		<table width="100%" cellspacing="0" cellpadding="4">
		<tr> 
			<td class = "text">*Имя -> </td>
			<td><input type="text" name="tbName" maxlength="50" size="20" value="${person.name}"></td>
		</tr>
		<tr> 
			<td class = "text">*Фамилия -> </td>
			<td><input type="text" name="tbSurname" maxlength="50" size="20" value="${person.surname}"></td>
		</tr>
		<tr> 
			<td class = "text">*Отчество -> </td>
			<td><input type="text" name="tbMiddlename" maxlength="50" size="20" value="${person.middlename}"></td>
		</tr>
		<tr> 
			<td class = "text">*Телефон мобильный -> </td>
			<td><input type="text" name="tbMobile" maxlength="50" size="20" value="${person.mobile}"></td>
		</tr>
		<tr> 
			<td class = "text">Телефон домашний -> </td>
			<td><input type="text" name="tbHomephone" maxlength="50" size="20" value="${person.phonehome}"></td>
		</tr>
		<tr> 
			<td class = "text">Адрес -> </td>
			<td><input type="text" name="tbAddress" maxlength="50" size="20" value="${person.address}"></td>
		</tr>
		<tr> 
			<td class = "text">Email -> </td>
			<td><input type="text" name="tbMail" maxlength="50" size="20" value="${person.mail}"></td>
		</tr>
	</table>

	 <input type="submit" formaction="?action=edit&id=${param.id}" name="btnEdit" value="Редактировать" />
		
	 </form>
	 <input type="submit" onClick="btnCancelClick()" name="btnCancel" value="Отменить" />
 </div>
<jsp:include page="footer.jsp" />